﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Model;
using Model.Components;
using FrameWork;
using FrameWork.Components;
using FrameWork.WebControls;

namespace FrameWork.web.Web
{
    public partial class Add : System.Web.UI.Page
    {
        Int32 IDX = (Int32)Common.sink("IDX", MethodType.Get, 10, 0, DataType.Int);

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
               string checkcode= Session["CheckCode"].ToString();
            }
            catch
            {
                EventMessage.MessageBox(1, "操作失败", "验证码错误!", Icon_Type.Error, "history.back();", UrlType.JavaScript);
            }
                if (vCode.Text == Session["CheckCode"].ToString())
                {

                    string TID_Value = "莱环网" + Common.sRndNum(3);
                    string TPassword_Value = Common.RndNum(4);
                    string TName_Value = (string)Common.sink(TName_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
                    string TNo_Value = (string)Common.sink(TNo_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
                    string TPhone_Value = (string)Common.sink(TPhone_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
                    string TGroup_Value = (string)Common.sink(TGroup_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
                    string TBGName_Value = (string)Common.sink(TBGName_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
                    string TBAddress_Value = (string)Common.sink(TBAddress_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
                    string TTtle_Value = (string)Common.sink(TTtle_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
                    string TContent_Value = (string)Common.sink(TContent_Input.UniqueID, MethodType.Post, 5000, 0, DataType.Str);

                    DateTime? TTime_Value = DateTime.Now;


                    T_WebEntity ut = BusinessFacadeModel.T_WebDisp(IDX);

                    ut.TID = TID_Value;
                    ut.TPassword = TPassword_Value;
                    ut.TName = TName_Value;
                    ut.TNo = TNo_Value;
                    ut.TPhone = TPhone_Value;
                    ut.TGroup = TGroup_Value;
                    ut.TBGName = TBGName_Value;
                    ut.TBAddress = TBAddress_Value;
                    ut.TTtle = TTtle_Value;
                    ut.TContent = TContent_Value;
                    ut.TTime = TTime_Value;
                    ut.XIF = "未完结";
                    ut.zhuangtai = "未处理";
                    ut.DataTable_Action_ = DataTable_Action.Insert;

                    Int32 rInt = BusinessFacadeModel.T_WebInsertUpdateDelete(ut);
                    if (rInt > 0)
                    {
                        string OpTxt = string.Format("增加网上投诉成功!(ID:{0})", rInt);

                        EventMessage.MessageBox(1, "操作成功", OpTxt, Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("OK.aspx?IDX={0}", rInt)));
                    }
                     
                    else
                    {
                        EventMessage.MessageBox(1, "操作失败", string.Format("操作失败,返回值:{0}!", rInt), Icon_Type.Error, "history.back();", UrlType.JavaScript);
                    }
                }
                else
                {
                    EventMessage.MessageBox(1, "操作失败", "验证码错误!", Icon_Type.Error, "history.back();", UrlType.JavaScript);

                }
            
        }
    }
}